package zozopo.business;


import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.SessionAware;

import zozopo.background.operator.operations.OperatorOS;
import zozopo.background.operator.operations.OperatorTB;
import zozopo.operations.business.IPReportOS;
import zozopo.operations.business.IPReportTB;
import zozopo.user.operations.UserOS;
import zozopo.user.operations.UserTB;


import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class PreIPReportAction extends ActionSupport implements Action,SessionAware{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	HttpServletRequest request;
	HttpServletResponse response;
	private Map<Object, Object> session;
	
	//分页参数
	private int beginPageNum = 0;
	private int pageSize = 50;
	private int rowNum = 0;
	
	List<IPReportTB> ipReportList;
	
	
	public String execute(){
		//权限处理
		OperatorTB operator = (OperatorTB)session.get("operatorInfo"); 
		
		if(!OperatorOS.operatorFlagLeve(operator, 5, 1)){
			return NONE;
		}
		
		IPReportOS ipReportOS = new IPReportOS();
		
		ipReportList = ipReportOS.selectIPReport(beginPageNum, pageSize);
		rowNum = ipReportOS.getRowNum(beginPageNum, pageSize);
		ipReportOS.releaseConnection();
		return SUCCESS;
	}
	

	public void setServletRequest(HttpServletRequest arg0) {
		// TODO Auto-generated method stub
		request = arg0;
	}

	public void setServletResponse(HttpServletResponse arg0) {
		// TODO Auto-generated method stub
		response = arg0;
	}

	public List<IPReportTB> getIpReportList() {
		return ipReportList;
	}

	public void setIpReportList(List<IPReportTB> ipReportList) {
		this.ipReportList = ipReportList;
	}

	public void setSession(Map arg0) {
		// TODO Auto-generated method stub
		session = arg0;
	}

	public int getBeginPageNum() {
		return beginPageNum;
	}

	public void setBeginPageNum(int beginPageNum) {
		this.beginPageNum = beginPageNum;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getRowNum() {
		return rowNum;
	}

	public void setRowNum(int rowNum) {
		this.rowNum = rowNum;
	}
}
